package mt.demo.service.security;

import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * Created by watson on 2015/11/12.
 */
public class WatPasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return rawPassword.toString();
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        try {
            //这里是密码加密
            //return BCrypt.checkpw(rawPassword.toString(), encodedPassword);
            return true;
        } catch (IllegalArgumentException e) {
            return false;
        }
    }
}
